<template>
  <div class="hospital-info">
    <div class="hospital-card">
      <div class="hospital-image">
        <img :src="hospital.image || '/images/hospital-default.jpg'" alt="医院图片" />
      </div>
      <div class="hospital-details">
        <div class="hospital-name">{{ hospital.name }}</div>
        <div class="hospital-level">{{ hospital.level }} | {{ hospital.type }}</div>
        <div class="hospital-tags">
          <span class="tag blue">受信医院</span>
          <span class="tag green">可线上复诊</span>
        </div>
        <div class="hospital-address">
          <van-icon name="location-o" color="#F56C6C" />
          <span>{{ hospital.address }}</span>
        </div>
      </div>
    </div>
    
    <div class="action-buttons">
      <div class="action" @click="onCall">
        <van-icon name="phone-o" size="24" color="#3296FA" />
        <span>联系电话</span>
      </div>
      <div class="action" @click="onNavigate">
        <van-icon name="guide-o" size="24" color="#67C23A" />
        <span>导航</span>
      </div>
      <div class="action" @click="onShare">
        <van-icon name="share-o" size="24" color="#E6A23C" />
        <span>分享</span>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { showToast } from 'vant'

interface HospitalInfoProps {
  hospital: {
    id: number
    name: string
    image?: string
    level: string
    type: string
    address: string
    phone: string
  }
}

const props = defineProps<HospitalInfoProps>()

const onCall = () => {
  showToast(`拨打电话: ${props.hospital.phone}`)
  // 在实际应用中可以使用 window.location.href = `tel:${props.hospital.phone}`
}

const onNavigate = () => {
  showToast('正在打开导航...')
  // 在实际应用中可以集成地图SDK进行导航
}

const onShare = () => {
  showToast('分享功能待实现')
  // 在实际应用中可以集成分享SDK
}
</script>

<style scoped lang="scss">
.hospital-info {
  background: #fff;
  padding: 16px;
  margin-bottom: 8px;
  
  .hospital-card {
    display: flex;
    margin-bottom: 16px;
    
    .hospital-image {
      width: 80px;
      height: 80px;
      margin-right: 12px;
      
      img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 4px;
        border: 1px solid #eee;
      }
    }
    
    .hospital-details {
      flex: 1;
      
      .hospital-name {
        font-size: 16px;
        font-weight: 500;
        color: #333;
        margin-bottom: 6px;
      }
      
      .hospital-level {
        font-size: 14px;
        color: #666;
        margin-bottom: 6px;
      }
      
      .hospital-tags {
        margin-bottom: 6px;
        
        .tag {
          display: inline-block;
          padding: 2px 6px;
          border-radius: 4px;
          font-size: 12px;
          margin-right: 8px;
          
          &.blue {
            background: #E6F7FF;
            color: #1890FF;
          }
          
          &.green {
            background: #F0F9EB;
            color: #67C23A;
          }
        }
      }
      
      .hospital-address {
        display: flex;
        align-items: center;
        font-size: 12px;
        color: #999;
        
        .van-icon {
          margin-right: 4px;
        }
      }
    }
  }
  
  .action-buttons {
    display: flex;
    justify-content: space-around;
    border-top: 1px solid #f5f5f5;
    padding-top: 12px;
    
    .action {
      display: flex;
      flex-direction: column;
      align-items: center;
      
      span {
        font-size: 12px;
        color: #666;
        margin-top: 4px;
      }
    }
  }
}
</style> 